ActiveReports 9 Server
Get a Security Token

When you use the HTML5 Viewer to access the ActiveReports 9 Server web site, you need to provide the Report Service with a security token to use.

Below are the steps to retrieve a security token.

To get a security token by the Javascript function

  1. In the target HTML page, add the following code to get a security token. The code might vary depending on the technology that you use to develop the HTML5 Viewer component. For more information, see the HTML5 Viewer Sample. By default, this sample is in the following folder.

    C:\ActiveReports 9 Server\SDK\Samples\HTML5 Viewer.

    Note: You need to change these settings in the code below.

    • url parameter represents the location (reportservice.svc/json/login) which stays constant where as the arsEndpoint represents the URL used to access the Report Portal Website. Example: http://<ActiveReports9ServerName>:<portnumber>.
    • username is your username to log into the ActiveReports 9 Server web site.
    • password is your password to log into the ActiveReports 9 Server web site.
    Javascript
    Copy Code
    function getSecurityToken() {
        if (_securityToken) return _securityToken;
        _securityToken = "error";
    
        try {
            $.ajax({
                 async: false,
                 type: "POST",
                 url: arsEndpoint + "ReportService.svc/json/Login",
                 data: JSON.stringify({
                       username: "username",
                       password: "password"
                 }),
                 contentType: "application/json",
                 dataType: "json"
            }).done(function(res) {
                  _securityToken = res.d;
            }).fail(function() {
                  _securityToken = "error";
            });
        } catch(e) {
              return "error";
        }
    
        return _securityToken;
    }
    

To get a security token from the cache

  1. Open your ActiveReports 9 Server web site and then open the web browser Developer Tools
    Note: Press F12 to open the web browser Developer Tools in Google Chrome, Internet Explorer, or Mozilla Firefox.
  2. In the Developer Tools window, go to the Resources tab and then to the Cookies > ActiveReports 9 Server name.
  3. In the Reports list of the Administrator Dashboard, click Preview to the right of any report to open it.
  4. Find the string that starts with SECURITYTOKEN=.
  5. Copy the value till the next delimiter and paste it to the Javascript code used for the HTML5 Viewer options.
See Also

SDK Tutorials

 

 


Copyright © 2014 GrapeCity, inc. All rights reserved

Support Forum